/*动态改变根元素字体大小*/
function recalc() {
	var clientHeight = document.documentElement.clientHeight;
	if(!clientHeight) return;
	document.documentElement.style.fontSize = 20 * (clientHeight / 1008) + 'px';
}

function initRecalc() {
	recalc();
	var resizeEvt = 'osrientationchange' in window ? 'orientationchange' : 'resize';
	if(!document.addEventListener) return;
	window.addEventListener(resizeEvt, recalc, false);
	document.addEventListener('DOMContentLoaded', recalc, false);
}
initRecalc();
//音乐按钮
(function() {
	var onoff = true;
	$(".yinye").on("touchend", function() {
		if(onoff) {
			$(this).css("animation-play-state", "paused");
			$(".audio")[0].pause();
		} else {
			$(this).css("animation-play-state", "running");
			$(".audio")[0].play();
		}
		onoff = !onoff;
	})
})();
//微信自动播放音乐
function audioAutoPlay(classname){
    var audio = $(classname)[0];
    audio.play();
    document.addEventListener("WeixinJSBridgeReady", function () {
        audio.play();
    }, false);
}
audioAutoPlay('.audio');

//遮罩弹窗
function mask(obj1,obj2) {
	var dHeight=$(document).height();
	var objHeight=obj2.height();
	obj2.css({y:-(dHeight/2+objHeight)+"px"});
	obj1.fadeIn(500,function () {
		obj2.transition({
			y:0
		})
	});
}